package com.t174.car.controller;

import com.t174.car.dao.StateDao;
import com.t174.car.entity.State;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/states")
@Scope("prototype")
public class StatesController {
    @Autowired
    StateDao statesDao;
    @RequestMapping("/chax")
    @ResponseBody
    public List<State> query(){
        return  statesDao.showquery();
    }
    @RequestMapping("/addstates")
    @ResponseBody
    public int Addstates(State state){
        System.out.println(state.getState());
        System.out.println(state.getUserid());
        return  statesDao.addStates(state);
    }
}
